import Request from '../../utils/request.js';

/**
 * 提现接口
 * @param {Object} params - 提现参数
 * @param {string} params.channel - 提现渠道 (channel)
 * @param {number} params.amount - 提现金额
 * @returns {Promise} 提现结果
 */
export const withdraw = (params) => {
  return Request.post(`/api/member/wallet/withdraw`, {
    channel: params.channel,
    amount: params.amount
  });

}

export const withdrawCancel = (id) => {
  return Request.post(`/api/member/wallet/withdraw/cancel`, {
    id: id
  });

}

export const withdrawFirstNotify = (id) => {
  return Request.post(`/api/member/wallet/withdraw/notify/first`, {
    id: id
  });

}



/**
 * 获取钱包流水列表
 * @param {Object} params - 查询参数
 * @param {number|string} params.isIncome - 收支类型：空为全部，1为支出，0为收入
 * @param {number} params.page - 页码，默认1
 * @param {number} params.pageSize - 每页数量，默认10
 * @returns {Promise} 钱包流水列表
 */
export const getWalletPage = (params = {}) => {
  return Request.post('/api/member/wallet/page', {
    isIncome: params.isIncome,
    pageNo: params.pageNo || 1,
    pageSize: params.pageSize || 10
  });
}